package display;

import javax.swing.JFrame;
import javax.swing.JPanel;

import universe.Block;
import universe.BlockHandler;
import universe.Board;

public class MainTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		JFrame oFrame = new JFrame();
		JPanel oPanel = new JPanel();
		
		Block oBlock = Block.getRandomBlock();
		System.out.println(oBlock.toString());
		Board oBoard = new Board(universe.Utils.BOARD_WIDTH,universe.Utils.BOARD_HEIGHT);
		BlockHandler  oBlockHandler = new BlockHandler(oBlock, oBoard);
		
  		BlockDisplay oBlockDisplay = new BlockDisplay(null);
		
		// Pour positionner la fenetre (plus ou moins) au centre de l'ecran : plutôt moins que plus d'ailleurs...
		oFrame.setLocationRelativeTo(null);
		oFrame.setSize(oBoard.getWidth()*Utils.sideWidth, oBoard.getHeight()*Utils.sideWidth);
		oFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		oFrame.setTitle("Wouah comment c'est trop beau !!!");
		
		oBlockHandler.setX(oBoard.getWidth()/2-2);
		oBlockHandler.setY(0);
		
		
		oBlockDisplay.setBlockHandler(oBlockHandler);
		//oBlockDisplay.setBackground(Color.BLACK);
		//oBlockDisplay.setOpaque(false);
		
		//oBlockDisplay.s
		oPanel.add(oBlockDisplay);
		
		//oFrame.setContentPane(oPanel);
		
		oFrame.getContentPane().add(oPanel);
		oFrame.getContentPane().add(oBlockDisplay);
		
		//oBlockDisplay.repaint();
		
		oFrame.setVisible(true);
	}

}
